package it.k2t.timesheet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class MainAndreaServlet extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		resp.setContentType("application/json");
		PrintWriter writer = resp.getWriter();
		String jsonData = fetchUserData(req);
		
		resp.getWriter().print(jsonData.getBytes("UTF-8"));
	}

	private String fetchUserData(HttpServletRequest req) {
		String data = "{\"Name\" : \"Rowan\", \"Breed\" : \"Labrador Retriever\", \"Hobbies\" : [\"fetching\", \"swimming\", \"tugging\", \"eating\"]}";
		return data;
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		super.doPost(req, resp);
	}

}
